USE [FriendsNearby]
GO
/****** Object:  Table [dbo].[UserNotifications]    Script Date: 01/14/2008 09:42:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserNotifications](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[UserId] [nvarchar](50) NOT NULL,
	[Timestamp] [datetime] NOT NULL,
 CONSTRAINT [PK_UserNotifications] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UserLocationHistory]    Script Date: 01/14/2008 09:42:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserLocationHistory](
	[Id] [uniqueidentifier] NOT NULL CONSTRAINT [DF_UserLocationHistory_Id]  DEFAULT (newid()),
	[FacebookUserId] [nvarchar](50) NULL,
	[Lat] [float] NULL,
	[Long] [float] NULL,
	[Timestamp] [datetime] NULL CONSTRAINT [DF_UserLocationHistory_Timestamp]  DEFAULT (getdate()),
 CONSTRAINT [PK_UserLocationHistory] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LogTwitterMessages]    Script Date: 01/14/2008 09:41:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[LogTwitterMessages](
	[LogId] [int] IDENTITY(1,1) NOT NULL,
	[IncomingMessage] [varchar](255) NULL,
	[OutgoingMessage] [varchar](1024) NULL,
	[Processor] [varchar](100) NOT NULL,
	[ExceptionWhileProcessingText] [varchar](max) NULL,
	[ExceptionWhileProcessingType] [varchar](100) NULL,
	[TimeStamp] [datetime] NOT NULL,
	[TwitterUser] [varchar](50) NOT NULL,
 CONSTRAINT [PK_LogTwitterMessages] PRIMARY KEY CLUSTERED 
(
	[LogId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserLocation]    Script Date: 01/14/2008 09:42:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserLocation](
	[FacebookUserId] [varchar](50) NOT NULL,
	[Lat] [float] NULL,
	[Long] [float] NULL,
 CONSTRAINT [PK_UserLocation] PRIMARY KEY CLUSTERED 
(
	[FacebookUserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserRegistry]    Script Date: 01/14/2008 09:42:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserRegistry](
	[FacebookUserId] [varchar](50) NOT NULL,
	[SessionKey] [varchar](50) NOT NULL,
	[InternalUserID] [uniqueidentifier] NOT NULL CONSTRAINT [DF_UserRegistry_InternalUserID]  DEFAULT (newid()),
 CONSTRAINT [PK_UserRegistry] PRIMARY KEY CLUSTERED 
(
	[FacebookUserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserPreferences]    Script Date: 01/14/2008 09:42:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserPreferences](
	[FacebookUserId] [varchar](50) NOT NULL,
	[VisibilityLevel] [int] NOT NULL CONSTRAINT [DF_UserPreferences_visibilityLevel]  DEFAULT ((0)),
	[NearbyRadiusKM] [int] NOT NULL CONSTRAINT [DF_UserPreferences_nearbyRadiusKM]  DEFAULT ((50)),
	[TwitterScreenName] [varchar](50) NULL,
 CONSTRAINT [PK_UserPreferences] PRIMARY KEY CLUSTERED 
(
	[FacebookUserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
